package top.tenebrous.termbor.rpc.loadbalance;

import top.tenebrous.termbor.rpc.common.constants.RpcConstants;
import top.tenebrous.termbor.rpc.spi.SPI;

import java.util.List;

/**
 * @program: termbor-rpc
 * @description:
 * @author: yazhang6
 * @create: 2024-05-23 17:13
 **/
@SPI(value = RpcConstants.SERVICE_LOAD_BALANCER_RANDOM)
public interface ServiceLoadBalance<T> {

    /**
     * 以负载均衡的方式选取一个服务节点
     * @param servers
     * @param hashCode
     * @return
     */
    T select(List<T> servers, int hashCode);

}
